<template>
	<view class="page-wrapper">
		<view class="flex center " style="padding-top: 60rpx;">
			<!-- <image src="../../../static/img/member/codeBack.png" style="width: 662rpx;height: 854rpx;"></image> -->
			<view style="width: 662rpx;height: 854rpx;background-image: url('https://sed-cf.oss-cn-shanghai.aliyuncs.com/wximg/codeBack.png?versionId=CAEQLhiBgIDyx.2phBgiIGJlNzFmM2VmN2NmYzRiZTJiNzRjMDU2MGU4ODI2ZDRl');background-size: 100% auto;">
				<view class="flex center" style="margin-top: 120rpx;font-size: 32rpx;">{{ name }}</view>
				<view style="width: 330rpx;height: 330rpx;margin: 50rpx auto;margin-bottom: 38rpx;"><image :src="codeImg" style="width: 330rpx;height: 330rpx"></image></view>
				<view class="flex between" style="width: 388rpx;color: #4694ff;margin: 0 auto;">
					<view class="" @click="gomianxiang()">免享星</view>
					<view class="">我的家园</view>
				</view>
				<view class="flex center" style="margin-top: 82rpx;">长按二维码/扫一扫,分享您的好友</view>
			</view>
		</view>

		<view class="flex center align" style="margin-top: 100rpx;">
			<button open-type="share" class="flex column align" style="color: white;border: none;margin: 0;margin-right: 180rpx;" plain>
				<view style="width:100rpx;height: 100rpx;"><uni-icons type="weixin" size="26" color="white"></uni-icons></view>
				<view style="color: white;font-size: 24rpx;">分享至微信</view>
			</button>

			<!-- 	<view class="flex column align" style="color: white;width:100rpx;height: 100rpx;">
				<view style="width:100rpx;height: 100rpx;"><uni-icons type="image-filled" size="26" color="white"></uni-icons></view>
				<view>保存二维码</view>
			</view> -->

			<button @click="upImg()" class="flex column align" style="color: white;border: none;margin: 0;" plain>
				<view style="width:100rpx;height: 100rpx;"><uni-icons type="image-filled" size="26" color="white"></uni-icons></view>
				<view style="color: white;font-size: 24rpx;">保存二维码</view>
			</button>
		</view>
	</view>
</template>

<script>
import { api } from '@/util/api.js';
export default {
	data() {
		return {
			codeImg: null,
			name: '获取中'
		};
	},
	onLoad(e) {
		this.name = e.name;
		api.getQrCode({}, res => {
			console.log('res', res);
			this.codeImg = res.data.path;
		});
	},
	methods: {
		gomianxiang() {
			uni.navigateTo({
				url: '../mianxiang/mianxiang'
			});
		},
		// onShareAppMessage(){
		// 	var that=this
		// 	let title,imageUrl;
		//     if (res.from === 'button') {
		//       // 来自页面内转发按钮
		//       title= '转发',
		//       imageUrl=that.codeImg;
		//     }

		//     return {
		//       title: title,
		//       imageUrl: imageUrl，//这个是分享的图片
		//       path: '/pages/index/index'，
		//     }
		//   },
		upImg() {
			var that = this;
			uni.saveImageToPhotosAlbum({
				filePath: that.codeImg,
				success: function() {
					console.log('save success');
				}
			});
		}
	}
};
</script>

<style scoped>
page {
	background-color: #4694ff;
}
.page-wrapper {
	background-color: #4694ff;
	box-sizing: border-box;
	font-size: 24rpx;
}
.box {
}
</style>
